package edu.nf.supermarket.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @author yjj
 * @date 2025-06-18
 */
@Configuration
@PropertySource("classpath:/file.properties")
public class FilePathConfig {
    @Value("${file.upload.base-path}")
    private String basePath;

    public String getAvatarPath() {
        return basePath + "avatars\\";
    }

    public String getCommentPath() {
        return basePath + "comments\\";
    }
    public String getProductPath() {
        return basePath + "products\\";
    }

    // 获取项目根目录的绝对路径
    public String getProjectRoot() {
        return System.getProperty("user.dir");
    }
}
